import BaseView from "../../../cfw/mvc/BaseView";
import DecorationController from "../DecorationController";
import DrawV1 from "../../../engine/comps/DrawV1";
import TextureInfo from "../../../engine/comps/TextureInfo";
import SDKManager from "../../../sdk/SDKManager";

const { ccclass, property } = cc._decorator;

@ccclass
export default class ColorRoomView extends BaseView {
    protected controller: DecorationController;

    @property(cc.Sprite)
    colorSprite: cc.Sprite = null;

    @property(DrawV1)
    draw: DrawV1 = null;

 
    changeColor(color: cc.Color) {
        cc.log(' color ', color)
        this.colorSprite.node.color = color;
    }


    onButtonBackClick() {
        this.controller.intoLobby()
    }

    onButtonNextClick() {
        if(SDKManager.getChannel().cantUseImageDataURL()){
            this.controller.intoLiveingRoom(this.draw.getTextureInfo());
        }else{
            this.controller.intoLiveingRoom(this.draw.getDataUrl());
        }
        
    }

}
